#include<stdio.h> 
#include<stdlib.h> 
int main(int argc, char *argv[]) 
{ 
char ch; 
FILE *fp; 
long count=0; 
char s[21]; 
if(argc !=2) 
{ 
printf("此文件名为：%s\n",argv[0]); 
exit(EXIT_FAILURE); 
} 
if ((fp=fopen(argv[1],"r+"))==NULL) 
{ 
fprintf(stderr,"这个文件打不开\"%s\"\n",argv[1]); 
exit(EXIT_FAILURE); 
} 
while(fscanf(fp,"%s",s)!=EOF) 
count++; 
fclose(fp); 
printf("File %s has %ld characters\n",argv[1],count); 
return 0; 
} 
